package com.sfx.concurrent.demo.concurrent.visibility;

import lombok.extern.slf4j.Slf4j;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2023-01-12
 * Time: 12:55
 */
@Slf4j(topic = "c.TestDemo1")
public class TestDemo1 {

    private volatile static  boolean running = true;
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            while(running){

            }
        });
        t1.start();
        System.out.println("停止t1");
        //主线程要停止t1线程的运行
        running = false;
        //log.debug("停止成功");
    }

}
